import tkinter as tk
from tkinter import messagebox


class MainWindow:

    def __init__(self):
        self.__main_window = tk.Tk()
        self.__main_window.title('Hand-write Digits Recognization')
        self.__main_window.geometry('1280x760')

        self.__main_window.protocol('WM_DELETE_WINDOW', self.query_window)
        text = tk.Label(
            self.__main_window,
            text='Hand-write Digits Recognization Program, powered by tkinter',
            bg='white',
            fg='black',
            font=('Times', 14, 'bold italic')
        )
        text.pack()

        button = tk.Button(
            self.__main_window,
            text='Quit',
            command=self.__main_window.quit
        )
        button.pack(side='bottom')

        btn_welcome = tk.Button(
            self.__main_window,
            text='Welcome',
            command=self.btn_callback
        )
        btn_welcome.pack(side='bottom')

        self.__main_window.mainloop()

        return

    def query_window(self):
        if messagebox.showwarning('Warning', 'Error occurred!'):
            self.__main_window.destroy()

    def btn_callback(self):
        print('btn_callback function is called!')


def main():
    """
    main function.

    :return: None
    """
    main_window = MainWindow()

    return


if __name__ == '__main__':
    main()
